Hello,
Can someone please tell me the solution for this issue. I am trying to connect to my exchange server and its throwing this error. I have also imported the certificate and placed in root folder. But still find the same error. Going craxy from 3 days plz someone help me.Here is my code:
public string CheckAvailability(string value){
try
{
//ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
//Connecting to EWS by using the EWS Managed API 2.0
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
// Connect by using the default credentials of the authenticated user.
//service.UseDefaultCredentials = true;
// Connect by using the credentials of user
service.Credentials = new NetworkCredential("UID", "PWD", "Domain");
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
// Use Autodiscover to set the URL endpoint.You should either set the URL explicitly or call AutodiscoverUrl, but you should not do both.
service.Url = new Uri("https://ad-lab/ews/Services.asmx");
//EmailMessage msg = new EmailMessage(service);
//msg.ToRecipients.Add(new EmailAddress("xyz@domain.com "));
//msg.Subject = "Test email";
//msg.Body = new MessageBody(BodyType.HTML, "<p>Hello Email!</p>");
//msg.Send();
GetUserFreeBusy(service);
return "Hello " + value;
}
catch (Exception ex)
{
return ex.Message;
}
finally { }
}
Thanks,
Sravani